package lab01;

public class Test13 {
    public static void main(String[] args) {
        int i = 1;
        int individual = 0;//定义个位
        int ten = 0;//定义十位
        int hundred = 0;//定义百位
        int thousand = 0;//定义千位
        for (i = 1;i < 1001;i ++){
            individual = i % 1000 % 100 % 10;//取出个位数值
            ten = i % 1000 % 100 / 10;//取出十位数值
            hundred = i % 1000 / 100;//取出百位数值
            thousand = i / 1000;//取出千位数值
            //判断是不是水仙花数
            if (thousand == 0 & hundred !=0){
                if (i == individual * individual * individual +
                        ten * ten * ten + hundred * hundred * hundred){
                    System.out.println(i);
                }
            }
        }
    }
}
